home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Sound / Amster / Source / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-19  |  2.5 KB  |  98 lines

  1. /*
  2. ** Amster - Main
  3. ** Copyright © 1999-2000 by Gürer Özen
  4. ** Copyright © 2000-2001 by Jacob Laursen
  5. **
  6. ** This program is free software; you can redistribute it and/or modify
  7. ** it under the terms of the GNU General Public License as published by
  8. ** the Free Software Foundation; either version 2 of the License, or
  9. ** (at your option) any later version.
  10. **
  11. ** This program is distributed in the hope that it will be useful,
  12. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ** GNU General Public License for more details.
  15. **
  16. ** You should have received a copy of the GNU General Public License
  17. ** along with this program; if not, write to the Free Software
  18. ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19. */
  20.  
  21. #include <proto/exec.h>
  22. #include <dos/dos.h>
  23.  
  24. #include "amster.h"
  25.  
  26. long __stack = AMSTER_STACK ;
  27.  
  28. #ifdef __MORPHOS__
  29. struct IntuitionBase *IntuitionBase = NULL;
  30. struct UtilityBase *UtilityBase = NULL;
  31. struct GfxBase *GfxBase = NULL;
  32. struct Library *IconBase = NULL;
  33. struct Library *AslBase = NULL;
  34. struct Library *RexxSysBase = NULL;
  35. #endif
  36.  
  37. int main(int argc, char *argv[])
  38. {
  39.     long sig;
  40.  
  41. #ifdef __MORPHOS__
  42.     IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 39L);
  43.     UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 37L);
  44.     GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 39L);
  45.     IconBase = OpenLibrary("icon.library", 37L);
  46.     AslBase = OpenLibrary("asl.library", 37L);
  47.     RexxSysBase = OpenLibrary("rexxsyslib.library", 37L);
  48.     if(!GfxBase || !IntuitionBase || !UtilityBase || !AslBase || !IconBase || !RexxSysBase) goto quit;
  49. #endif
  50.  
  51.     sig = AllocSignal(-1);
  52.     if (sig == -1) return 20;
  53.     nap_sigmask = 1L << sig;
  54.  
  55.     if (!th_init()) return 20;
  56.  
  57. #ifdef __SASC
  58.     if (argc == 0) {
  59.         argc = _WBArgc;
  60.         argv = _WBArgv;
  61.     }
  62. #endif
  63.  
  64.     prf_setup(argc, argv);
  65.     gui_run(nap_sigmask);
  66.  
  67.     FreeSignal(sig);
  68.  
  69. #ifdef __MORPHOS__
  70. quit:
  71.     if (RexxSysBase) CloseLibrary(RexxSysBase);
  72.     if (AslBase) CloseLibrary(AslBase);
  73.     if (IconBase) CloseLibrary(IconBase);
  74.     if (GfxBase) CloseLibrary((struct Library *)GfxBase);
  75.     if (UtilityBase) CloseLibrary((struct Library *)UtilityBase);
  76.     if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
  77. #endif
  78.  
  79.     return 0;
  80. }
  81.  
  82.  
  83. #ifndef __SASC
  84. /* Replacement for SAS/C function */
  85. extern int stcd_i(const char *in, int *ivalue)
  86. {
  87.     int i=0;
  88.  
  89.     ivalue = atoi(in);
  90.  
  91.     if(in[0] == '-' || in[0] == '+') i++;
  92.     while(in[i] >= '0' && in[i] <= '9')) i++;
  93.     if(in[0] == '-' || in[0] == '+') i--;
  94.  
  95.     return i;
  96. }
  97. #endif
  98.